/******************************************
 * window.h - header for the window class
 * for GUIZ
 *
 *
 * Author: Jeremy Zito
 * Date:   1/10/07
 ******************************************/
 
#ifndef WINDOW_H
#define WINDOW_H

#include <windows.h>
#include "gl.h"
#include <fstream>
#include <vector>
#include <map>
#include <string>

#include "button.h"
#include "textarea.h"
#include "textbox.h"
#include "listbox.h"
#include "graphic.h"



/***
 * define the window class 
 ***/
class window{
      
    public:            
                    
      //a vector of misc image names in skin
      std::vector<std::string> img_names; 
               
      //title for window
      char name[64];      
      //the skin index of the window
      //int skin;
      int skin;
      //the screen x, y position
      //and window width and height
      int x, y, w, h;
      //if the window is rendered
      bool visible;
      //if the window can be dragged
      bool wdrag;
	  //the window's id
	  int win_id;
      
      //a vector of all the window's buttons
      std::vector<button> buttons;
      //the window's textareas
      std::vector<textarea> texts;
      //the window's textboxes
      std::vector<textbox> textbs;
	  //the window's listboxes
      std::vector<listbox> listbs;
	  //the window's pictures
	  std::vector<graphic> gfxs;
                      
      
      //window class constructor
      window();
      //window class destructor
      ~window();
      
                             
      //creates a new button, returns the index of the button
      //in the specified window.
      //last parameter is a pointer to a function
      //this function will handle a click event.
      //the x and y position values will map to
      //the size of the window, if one is greater
      //than the size of the window, it will be placed
      //at the maximum for the window.
      int add_button(char*, int b_x, int b_y, int b_w, 
                     int b_h, char* image_up, char* image_down, 
                     void (*func_p)());
                  
                                       
      //create a textarea and add it to the window.
      //returns the index of the textarea. 
      int add_textarea(char* text, int t_x, int t_y);
	  
	  //create a textbox and add it to the window.
      //returns the index of the textbox. 
	  int add_textbox(int t_w, int t_h, int t_x, int t_y, int t_rgb[3]);

	  //create a listbox and add it to the window.
      //returns the index of the listbox. 
	  int add_listbox(int t_w, int t_h, int t_x, int t_y, int t_rgb[3]);

	  //create a graphic and add it to the window.
      //returns the index of the graphic. 
	  int add_graphic(char* img_name, int g_w, int g_h, int g_x, int g_y);
                      
                      
      //set the visibility of a window
      void set_visibility(bool p_visible);              
      
       
                      
      //set if the window can be dragged
      void set_window_drag(bool p_drag);

              
      bool can_drag();
      
      
      int get_image_id(std::string);
    
              
      //sets the text of a textarea
      void set_textarea_text(int text_id, std::string p_text);
      
      //move the window to a new xy position
      void move(int px, int py);                                            
              
};


#endif   /* WINDOW_H */
